﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PartyMasterPage.master" AutoEventWireup="true" CodeFile="OrganizationManage.aspx.cs" Inherits="OrganizationManage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>组织管理</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="Div_PartyBranchManage" runat ="server">
        创建新党支部
        <asp:TextBox ID="TBox_BranchName" runat="server"></asp:TextBox>
        <asp:Button ID="Btn_CreateBranch" runat="server" Text="创建" 
            onclick="Btn_CreateBranch_Click" />
        <asp:Label ID="Lb_CreateBranchMessage" runat="server"></asp:Label>
        
        <br />
        
        <asp:GridView ID="GView_ExistedBranch" runat="server" 
            AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" 
            BorderStyle="None" BorderWidth="1px" CellPadding="4" 
            DataSourceID="ADSource_PartyBranch">
            <RowStyle BackColor="White" ForeColor="#330099" />
            <Columns>
                <asp:TemplateField HeaderText="党支部">
                    <ItemTemplate>
                        <asp:Label ID="lbName" Text='<%# Eval("PartyBranchName") %>' runat="server"></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TBox_PartyBranchName" runat="server" Text='<%# Eval("PartyBranchName").ToString().Trim()%>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField>
                        <ItemTemplate>
                            <asp:ImageButton ID="Btn_PartyBranchEdit" runat="server" ImageUrl="~/img/edit.png" CommandName="Edit"  ToolTip="编辑" />
                            <asp:ImageButton ID="Btn_PartyBranchDelete" runat="server" ImageUrl="~/img/delete.png" CommandName="Delete"  ToolTip="删除" 
                                OnClick='<%# "if (!confirm(\"确认要删除此条数据？删除后不可恢复。\\r\\t党支部：" + Eval("PartyBranchName").ToString().Trim() +  "\")) return false;"%>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:ImageButton ID="Btn_PartyBranchUpdate" runat="server" ImageUrl="~/img/ok.png" CommandName="Update"
                                ToolTip="更新" />
                            <asp:ImageButton ID="Btn_PartyBranchCancel" runat="server" ImageUrl="~/img/cancel.png" CommandName="Cancel"
                                ToolTip="取消" />
                        </EditItemTemplate>
                    </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
        </asp:GridView>
        <asp:AccessDataSource ID="ADSource_PartyBranch" runat="server" 
            DataFile="~/App_Data/jwb.mdb" 
            SelectCommand="SELECT [PartyBranchName] FROM [party_PartyGroup] WHERE ([IsPartyBranch] = ?)">
            <SelectParameters>
                <asp:Parameter DefaultValue="True" Name="IsPartyBranch" Type="Boolean" />
            </SelectParameters>
        </asp:AccessDataSource>
    </div>
    <hr />
    <div id="Div_PartyGroupManage" runat ="server" >
        创建新党小组
        <br />
        党小组名称
        <asp:TextBox ID="TBox_PartyGroupName" runat="server"></asp:TextBox>
        所属党支部
        <asp:DropDownList ID="DDLst_PartyBranch" runat="server" 
            DataSourceID="ADSource_PartyBranch" DataTextField="PartyBranchName" 
            DataValueField="PartyBranchName">
        </asp:DropDownList>
        <asp:Button ID="Btn_CreatePartyGroup" runat="server" Text="创建" 
            onclick="Btn_CreatePartyGroup_Click" />
        <asp:Label ID="Lb_CreatePartyGroupMessage" runat="server"></asp:Label>
    <br />
    <asp:GridView ID="GView_ExistedGroup" runat="server" BackColor="White" 
            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
            AutoGenerateColumns="False" DataSourceID="ADSource_PartyGroup">
        <RowStyle BackColor="White" ForeColor="#330099" />
        <Columns>
            <asp:TemplateField HeaderText="党小组">
                <ItemTemplate>
                    <asp:Label ID="Lb_PartyGroupName" Text='<%# Eval("PartyGroupName") %>' runat="server"></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TBox_PartyGroupName" runat="server" Text='<%# Eval("PartyGroupName").ToString().Trim()%>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="党支部">
                <ItemTemplate>
                    <asp:Label ID="Lb_PartyBranchName" Text='<%# Eval("PartyBranchName") %>' runat="server"></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="DDLst_SelectPartyBranchName" runat="server" DataSourceID="ADSource_PartyBranch"
                        DataTextField="PartyBranchName" DataValueField="PartyBranchName" >
                    </asp:DropDownList>
                </EditItemTemplate>
                <%--<EditItemTemplate>
                    <asp:TextBox ID="TBox_PartyBranchName" runat="server" Text='<%# Eval("PartyBranchName").ToString().Trim()%>'></asp:TextBox>
                </EditItemTemplate>--%>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="Btn_PartyGroupEdit" runat="server" ImageUrl="~/img/edit.png" CommandName="Edit"
                        ToolTip="编辑" />
                    <asp:ImageButton ID="Btn_PartyGroupDelete" runat="server" ImageUrl="~/img/delete.png" CommandName="Delete"
                        ToolTip="删除" OnClick='<%# "if (!confirm(\"确认要删除此条数据？删除后不可恢复。\\r\\t党支部：" + Eval("PartyBranchName").ToString().Trim() +  "\")) return false;"%>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:ImageButton ID="Btn_PartyGroupUpdate" runat="server" ImageUrl="~/img/ok.png" CommandName="Update"
                        ToolTip="更新" />
                    <asp:ImageButton ID="Btn_PartyGroupCancel" runat="server" ImageUrl="~/img/cancel.png" CommandName="Cancel"
                        ToolTip="取消" />
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
    </asp:GridView>
        <asp:AccessDataSource ID="ADSource_PartyGroup" runat="server" 
            DataFile="~/App_Data/jwb.mdb" 
            SelectCommand="SELECT DISTINCT [PartyGroupName], [PartyBranchName] FROM [party_PartyGroup] WHERE ([IsPartyBranch] = ?) ORDER BY [PartyBranchName], [PartyGroupName]">
            <SelectParameters>
                <asp:Parameter DefaultValue="False" Name="IsPartyBranch" Type="Boolean" />
            </SelectParameters>
        </asp:AccessDataSource>
    </div>
</asp:Content>

